// To parse this JSON data, do
//
//     final paymentPlan = paymentPlanFromJson(jsonString);

import 'dart:convert';

List<SubscriptionPlan> subscriptionPlanFromJson(String str) => List<SubscriptionPlan>.from(json.decode(str).map((x) => SubscriptionPlan.fromJson(x)));

String subscriptionPlanToJson(List<SubscriptionPlan> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson())));

class SubscriptionPlan {
    SubscriptionPlan({
        this.id,
        this.addOns,
        this.merchantId,
        this.billingDayOfMonth,
        this.billingFrequency,
        this.currencyIsoCode,
        this.description,
        this.discounts,
        this.name,
        this.numberOfBillingCycles,
        this.price,
        this.trialDuration,
        this.trialDurationUnit,
        this.createdAt,
        this.updatedAt,
    });

    String? id;
    List<dynamic>? addOns;
    String? merchantId;
    dynamic billingDayOfMonth;
    int? billingFrequency;
    String? currencyIsoCode;
    String? description;
    List<dynamic>? discounts;
    String? name;
    dynamic numberOfBillingCycles;
    double? price;
    dynamic trialDuration;
    dynamic trialDurationUnit;
    int? createdAt;
    int? updatedAt;

    factory SubscriptionPlan.fromJson(Map<String, dynamic> json) => SubscriptionPlan(
        id: json["id"],
        addOns: List<dynamic>.from(json["addOns"].map((x) => x)),
        merchantId: json["merchantId"],
        billingDayOfMonth: json["billingDayOfMonth"],
        billingFrequency: json["billingFrequency"],
        currencyIsoCode: json["currencyIsoCode"],
        description: json["description"],
        discounts: List<dynamic>.from(json["discounts"].map((x) => x)),
        name: json["name"],
        numberOfBillingCycles: json["numberOfBillingCycles"],
        price: json["price"].toDouble(),
        trialDuration: json["trialDuration"],
        trialDurationUnit: json["trialDurationUnit"],
        createdAt: json["createdAt"],
        updatedAt: json["updatedAt"],
    );

    Map<String, dynamic> toJson() => {
        "id": id,
        "addOns": addOns!=null ? List<dynamic>.from(addOns!.map((x) => x)) : null,
        "merchantId": merchantId,
        "billingDayOfMonth": billingDayOfMonth,
        "billingFrequency": billingFrequency,
        "currencyIsoCode": currencyIsoCode,
        "description": description,
        "discounts":discounts!=null ? List<dynamic>.from(discounts!.map((x) => x)) : null,
        "name": name,
        "numberOfBillingCycles": numberOfBillingCycles,
        "price": price,
        "trialDuration": trialDuration,
        "trialDurationUnit": trialDurationUnit,
        "createdAt": createdAt,
        "updatedAt": updatedAt,
    };
}
